#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QAction>
#include <QMenu>
#include <QMenuBar>
#include <QToolBar>
#include <QTableWidget>
#include <QFile>
#include <QVector>

#include "paramChooseDialog.h"
#include "ResultPaintDialog.h"
#include "ViewInputDialog.h"
#include "PTableWidget.h"
#include "Algorithms.h"
#include "taskEditor.h"
//#include "Assistant.h"
#include "taskType.h"
#include "helper.h"

#include "algo-busy.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:

    //int tasksCount;
    //QVector<OSTask> tasks;
    //QVector<QString> headers;

    //QTableWidget *table;
    PTableWidget *table;
    taskEditor *taskEd;

    paramChooseDialog   *paramDlg;
    ViewInputDialog     *viewInputDlg;
    ResultPaintDialog   *resultPrintDlg;
    //Assistant           *assist;
    helper              *helpDlg;


    taskType task;
    int lastReason;
    int rowClicked;

    QMenu *fileMenu;
    QMenu *editMenu;

    QToolBar *fileToolBar;
    QToolBar *editToolBar;

    QAction *newAction;
    QAction *openAction;
    QAction *deleteAction;
    QAction *editAction;
    QAction *viewResultAction;
    QAction *viewInputAction;
    QAction *helpAction;

    void createActions();
    void createMenus();
    void createToolBars();

    //void saveTasksList( bool def = false );
    //void saveHeadersList( bool def = false );

    //void loadTasksList();
    //void loadHeaderList();

    //algo
    //QVector<QVector<int> > order;
    //QVector<QVector<bool> > rowHas;
    //QVector<QVector<bool> > colHas;
    //int n;
    //int m;
    //int minimal;

private slots:
    //void editTask( int row, int col );
    void viewTaskResult();
    void viewTaskInput();
    void deleteTask();
    void editTask();
    void newTask();

    void taskMade( taskType task );
    int selectedRow();
    void showHelp();

    //void showInput( int row, int col );
    //void solve( taskType task );
    //void run(int mach, int det);

    void loadData();
    void saveData();
    void saveTaskInputOutput();
    //void saveQVectorToFile( const QVector<QVector<int> > );

};

#endif // MAINWINDOW_H
